/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.model.SelectItem;
import oracle.jdbc.OracleTypes;
import oracle.jdbc.oracore.OracleType;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.N950;
import queenb.web.exception.NoDataEffectException;
import queenb.web.inteface.ContactInf;
import queenb.web.util.PackageContants;

/**
 *
 * @author VANANH
 */
public class ContactStore extends N950 implements ContactInf {

    @Override
    public int updateN950By(int fn100, int pn950, String nv951, String nv952, String nv953, String nv954, String nv955, String nv956, String nv957, int fn750, String nv958, String nv959, String nv960, String nv961, String nv962, String nv963, String nv964, String nv965, String nv966, String nv967, String nv968, String nv969, java.sql.Date nd970, java.sql.Date nd971, int nn972,String nv973,String nv974,String nv975, String pnLogin) {
        try {
            DataStatement dateStatement = new DataStatement(PackageContants.UPDATE_N950, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, fn100),
                        new Param(OracleTypes.INTEGER, pn950),
                        new Param(OracleTypes.CHAR, nv951),
                        new Param(OracleTypes.CHAR, nv952),
                        new Param(OracleTypes.CHAR, nv953),
                        new Param(OracleTypes.CHAR, nv954),
                        new Param(OracleTypes.CHAR, nv955),
                        new Param(OracleTypes.CHAR, nv956),
                        new Param(OracleTypes.CHAR, nv957),
                        new Param(OracleTypes.INTEGER, fn750),
                        new Param(OracleTypes.CHAR, nv958),
                        new Param(OracleTypes.CHAR, nv959),
                        new Param(OracleTypes.CHAR, nv960),
                        new Param(OracleTypes.CHAR, nv961),
                        new Param(OracleTypes.CHAR, nv962),
                        new Param(OracleTypes.CHAR, nv963),
                        new Param(OracleTypes.CHAR, nv964),
                        new Param(OracleTypes.CHAR, nv965),
                        new Param(OracleTypes.CHAR, nv966),
                        new Param(OracleTypes.CHAR, nv967),
                        new Param(OracleTypes.CHAR, nv968),
                        new Param(OracleTypes.CHAR, nv969),
                        new Param(OracleTypes.DATE, nd970),
                        new Param(OracleTypes.DATE, nd971),
                        new Param(OracleTypes.INTEGER, nn972),
                         new Param(OracleTypes.CHAR, nv973),
                          new Param(OracleTypes.CHAR, nv974),
                           new Param(OracleTypes.CHAR, nv975),
                        new Param(OracleTypes.CHAR, pnLogin)});
            return super.update(dateStatement, N950.class);
        } catch (SQLException ex) {
            Logger.getLogger(ContactStore.class.getName()).log(Level.SEVERE, null, ex);
            System.out.println("loiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii" + ex);
            return 0;
        }
    }

    @Override
    public List<N950> getListContact(int fn100, int pn950, String pvLogin) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_N950, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, fn100),
                        new Param(OracleTypes.INTEGER, pn950),
                        new Param(OracleTypes.CHAR, pvLogin)
                    });
            return super.find(dataStatement, N950.class);
        } catch (SQLException ex) {
            Logger.getLogger(ContactStore.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(ContactStore.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(ContactStore.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public List<N950> getListContactpt(int fn100, int pn950, String pvLogin) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_N950PT, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, fn100),
                        new Param(OracleTypes.INTEGER, pn950),
                        new Param(OracleTypes.CHAR, pvLogin)
                    });
            return super.find(dataStatement, N950.class);
        } catch (SQLException ex) {
            Logger.getLogger(ContactStore.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(ContactStore.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(ContactStore.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public int deleteEmployee(int fn100, int pn950, String nv951, String pnLogin) {
        DataStatement dataStatement = new DataStatement(PackageContants.DELETE_N950, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, fn100),
                    new Param(OracleTypes.INTEGER, pn950),
                    new Param(OracleTypes.CHAR, nv951),
                    new Param(OracleTypes.CHAR, pnLogin)
                });
        try {
            return super.update(dataStatement, N950.class);
        } catch (SQLException ex) {
            Logger.getLogger(EmployeeStore.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public List<SelectItem> gCitySelect(String pnA000, int n750) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public List<N950> getListtestN950() {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_N950demo, null);
            return super.find(dataStatement, N950.class);
        } catch (SQLException ex) {
            Logger.getLogger(ContactStore.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(ContactStore.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(ContactStore.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public List<N950> getListN950ById(int fn100, int pn950) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
